package com.cmcc.pp.ui.gatewayadministration;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import com.cmcc.pp.R;
import com.cmcc.pp.app.UserManager;
import com.cmcc.pp.base.BActivity;
import com.cmcc.pp.util.PopuWindowForModesChoice;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by ABC on 2017/12/26.
 * <p>
 * Traceroute诊断
 */

public class TracerouteDiagnosisActivity extends BActivity implements View.OnClickListener {
    @Bind(R.id.trace_lin_choiceWAN)
    LinearLayout traceLinChoiceWAN;
    @Bind(R.id.trace_butt_start)
    Button traceButtStart;
    @Bind(R.id.trace_lin_diagnosis)
    RelativeLayout traceLinDiagnosis;
    @Bind(R.id.tracediag_scroll)
    ScrollView tracediagScroll;
    @Bind(R.id.tv_modechoice)
    TextView tvModechoice;
    @Bind(R.id.lin_modechoice)
    LinearLayout linModechoice;


    private String mode = "UDP";

    @Override
    protected boolean getHasTitle() {
        return true;
    }

    @Override
    public int getContentLayoutId() {
        return R.layout.activity_traceroutediagnosis;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        getHeader().setTitle(R.string.str_traceroutediagnosis);



    }


    @Override
    public void loadData() {

    }


    @OnClick({
            R.id.trace_lin_choiceWAN,
            R.id.trace_butt_start,
            R.id.lin_modechoice,

    })
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.trace_lin_choiceWAN:
                openChoiceWAN();
                break;
            case R.id.trace_butt_start:
                startTraceDiagnosis();
                break;
            case R.id.lin_modechoice:
                PopuWindowForModesChoice popuWindowForSetting = new PopuWindowForModesChoice();
                popuWindowForSetting.choicewindow(TracerouteDiagnosisActivity.this, linModechoice);
                break;
        }
    }


    //开始Ping诊断，显示诊断结果
    private void startTraceDiagnosis() {

    }

    //选择WAN
    private void openChoiceWAN() {
        Intent wanIntent = new Intent(this, SelectWANinkActivity.class);
        startActivity(wanIntent);
    }


    public void setTvModechoice(String string){
        tvModechoice.setText(string);
        mode = string;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }


}
